package com.lzp.appexp.service

import android.os.Parcel
import android.os.Parcelable
import kotlin.collections.ArrayList

/**
 * @describe:
 * @Author: lixiaopeng
 * @Date: 2021/6/17
 */
data class TestData(val list: ArrayList<String>) : Parcelable {

    override fun describeContents(): Int = 0

    override fun writeToParcel(dest: Parcel?, flags: Int) {
        dest?.writeList(list)
    }

    companion object CREATOR : Parcelable.Creator<TestData> {
        override fun createFromParcel(parcel: Parcel): TestData {
            return TestData(parcel)
        }

        override fun newArray(size: Int): Array<TestData?> {
            return arrayOfNulls(size)
        }
    }

    constructor(parcel: Parcel) : this(parcel.readArrayList(String::class.java.classLoader) as ArrayList<String>?
                                           ?: ArrayList<String>())
}